package com.leetcode;

/**
 * 70. 爬楼梯
 *
 * @author fy
 * @date 2022/3/28 20:15
 */
public class Solution70 {

    /**
     * 70. 爬楼梯
     *
     * @param n
     * @return
     */
    public int climbStairs(int n) {
        int[] memo = new int[n + 1];
        memo[0] = 0;
        memo[1] = 1;
        memo[2] = 2;

        for (int i = 3; i <= n; i++) {
            memo[i] = memo[i - 1] + memo[i - 2];
        }

        return memo[n];
    }

    public static void main(String[] args) {
        new Solution70().climbStairs(3);
    }

}
